
foreach x in white black indnat hisp male female nohigh highsch somecoll college {
	
	use "/projects/users/########/Snapshot2022/Results/lpdid2_strateq2_`x'2.dta", clear

	gen t = .
	replace t = -6 if vble=="pre6"
	replace t = -5 if vble=="pre5"
	replace t = -4 if vble=="pre4"
	replace t = -3 if vble=="pre3"
	replace t = -2 if vble=="pre2"
	replace t = -1 if vble=="pre1"
	replace t = 0 if vble=="tau0"
	replace t = 1 if vble=="tau1"
	replace t = 2 if vble=="tau2"
	replace t = 3 if vble=="tau3"
	replace t = 4 if vble=="tau4"
	replace t = 5 if vble=="tau5"
	replace t = 6 if vble=="tau6"

	collapse b_* (sd) sd_emp20bscpl0 = b_emp20bscpl0 ///
		sd_emp20cbscpl0 = b_emp20cbscpl0 sd_wg20bscpl0 = b_wg20bscpl0 ///
		sd_wg20cbscpl0 = b_wg20cbscpl0 ///
		, by(t)
	tsset t

	order t b_emp20b sd_emp20b b_wg20b sd_wg20b b_emp20c sd_emp20c b_wg20c sd_wg20c
	
	export delim using "/projects/users/########/Snapshot2022/Results/lpdid_event_`x'.csv", delim(",") replace
}

use "/projects/users/########/Snapshot2022/Results/lpdid2_strateq2_randall2.dta", clear

gen t = .
replace t = -6 if vble=="pre6"
replace t = -5 if vble=="pre5"
replace t = -4 if vble=="pre4"
replace t = -3 if vble=="pre3"
replace t = -2 if vble=="pre2"
replace t = -1 if vble=="pre1"
replace t = 0 if vble=="tau0"
replace t = 1 if vble=="tau1"
replace t = 2 if vble=="tau2"
replace t = 3 if vble=="tau3"
replace t = 4 if vble=="tau4"
replace t = 5 if vble=="tau5"
replace t = 6 if vble=="tau6"

collapse b_* (sd) sd_emp20bscpl0 = b_emp20bscpl0 ///
	sd_emp20cbscpl0 = b_emp20cbscpl0 sd_wg20bscpl0 = b_wg20bscpl0 ///
	sd_wg20cbscpl0 = b_wg20cbscpl0 ///
	, by(t)
tsset t

order t b_emp20b sd_emp20b b_wg20b sd_wg20b b_emp20c sd_emp20c b_wg20c sd_wg20c

export delim using "/projects/users/########/Snapshot2022/Results/lpdid_event_randall.csv", delim(",") replace


use "/projects/users/########/Snapshot2022/Results/lpdid2_strateq2_county2.dta", clear

foreach x in avg white black indnat hisp male female nohigh highsch somecoll college {
	preserve
	keep vble *_`x'
	order vble b_empt vnc_empt b_wgt vnc_wgt b_empc vnc_empc b_wgc vnc_wgc
	export delim using "/projects/users/########/Snapshot2022/Results/lpdid_event_cty_`x'.csv", delim(",") replace
	restore
}

